//
//  AY_BookSortCell.m
//  AiYue
//
//  Created by boWen on 2023/10/25.
//

#import "AY_BookSortCell.h"


@interface AY_BookSortCell ()
@property (strong,nonatomic) UIView * bg_View;
/** 书 */
@property (strong,nonatomic) UIImageView *bookImage;
/** 书名 */
@property (strong,nonatomic) UILabel * titleLabel;

@end

@implementation AY_BookSortCell



- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.bg_View = [AYTool createViewWithFrame:CGRectZero andBg:[UIColor whiteColor] andRadius:YNUM(8) andAddSubView:self.contentView];
        [self.bg_View mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.bottom.equalTo(self.contentView);
        }];
        
        self.bookImage = [AYTool createImageViewWithFrame:CGRectZero andImage:nil andBg:nil andRadius:YNUM(4) andAddSubView:self.bg_View];
        [self.bookImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(YNUM(52));
            make.width.mas_equalTo(40);
            make.centerY.equalTo(self.bg_View);
            make.right.equalTo(self.bg_View).offset(-YNUM(15));
        }];
        
        self.titleLabel = [AYTool createLabelWithFrame:CGRectZero andText:nil andTextColor:COLOR(@"#000002") andBgColor:nil andFont:[UIFont boldSystemFontOfSize:YNUM(14)] andLines:1 andRadius:0 andAddSubView:self.bg_View];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.bg_View);
            make.left.equalTo(self.bg_View).offset(YNUM(14));
        }];
        
    }
    return self;
}


- (void)setSxSortModel:(SortSubModel *)sxSortModel {
    _sxSortModel = sxSortModel;
    
    self.titleLabel.text = kStringUtils(_sxSortModel.name);
    [self.bookImage sd_setImageWithURL:[NSURL URLWithString:kStringUtils(_sxSortModel.image)] placeholderImage:YImage(@"placeholderImage")];
}


@end
